package com.design.mediator;

import java.util.HashMap;
import java.util.Map;

/**
 * @author cxx
 * @create 2020-04-20 17:28
 **/
public abstract class Mediator {

    private static final Map<String,Colleague> MAP = new HashMap<> ();

    abstract void operation(String fromUid, String toUid, String msg);

    public void register(String uid,Colleague colleague){
        MAP.put (uid,colleague);
        colleague.setMediator (this);
    }

    public static final Colleague get(String uid){
        return MAP.get (uid);
    }

}
